<!DOCTYPE html>
<html lang="zh-CN">
  <#include "header.html">
  <body id="nextContainer" class="content-box">
    <section class="content">
      <h4 style="margin-left: 50px;bottom: -32px;">风险管控示意图</h3>
      <div style=" display: inline-block;position: absolute;font-size: 3em;margin-left: 15px;top: 10%;font-family: serif;color: #f77a06;font-weight: bold;font-style: italic;">4</div>
      <br />
      <div class="main-box">
        <div class="main-inputbox2">
          <h4>${pzsw.questionName!}</h4>
          <code>${pzsw.questionReason1!}</code>
          <form id="selectForm">
	          <div class="cont-abox">
	            <a href="#" id="reason1Solve1" <#if pzsw.reason1Solve1.choose??&&pzsw.reason1Solve1.choose=='true'>class="onclick"</#if> onclick="clickA('reason1Solve1')">${(pzsw.reason1Solve1.name)!}</a>
	            <input type="hidden" value="${(pzsw.reason1Solve1.choose)!'false'}" name="reason1Solve1" />
	            <a href="#" id="reason1Solve2" <#if pzsw.reason1Solve2.choose??&&pzsw.reason1Solve2.choose=='true'>class="onclick"</#if> onclick="clickA('reason1Solve2')">${(pzsw.reason1Solve2.name)!}</a>
	            <input type="hidden" value="${(pzsw.reason1Solve2.choose)!'false'}" name="reason1Solve2" />
	            <div class="clearfix"></div>
	          </div>
	          <code>${pzsw.questionReason2!}</code>
	          <div class="cont-abox">
	            <a href="#" id="reason2Solve1" <#if pzsw.reason2Solve1.choose??&&pzsw.reason2Solve1.choose=='true'>class="onclick"</#if> onclick="clickA('reason2Solve1')">${(pzsw.reason2Solve1.name)!}</a>
	             <input type="hidden" value="${(pzsw.reason2Solve1.choose)!'false'}" name="reason2Solve1" />
	            <a href="#" id="reason2Solve2" <#if pzsw.reason2Solve2.choose??&&pzsw.reason2Solve2.choose=='true'>class="onclick"</#if> onclick="clickA('reason2Solve2')">${(pzsw.reason2Solve2.name)!}</a>
	            <input type="hidden" value="${(pzsw.reason2Solve2.choose)!'false'}" name="reason2Solve2" />
	            
	            <div class="clearfix"></div>
	          </div>
	          <code>${pzsw.questionReason3!}</code>
	          <div class="cont-abox">
	            <a href="#" id="reason3Solve1" <#if pzsw.reason3Solve1.choose??&&pzsw.reason3Solve1.choose=='true'>class="onclick"</#if> onclick="clickA('reason3Solve1')">${(pzsw.reason3Solve1.name)!}</a>
	            <input type="hidden" value="${(pzsw.reason3Solve1.choose)!'false'}" name="reason3Solve1" />
	            <a href="#" id="reason3Solve2" <#if pzsw.reason3Solve2.choose??&&pzsw.reason3Solve2.choose=='true'>class="onclick"</#if> onclick="clickA('reason3Solve2')">${(pzsw.reason3Solve2.name)!}</a>
	             <input type="hidden" value="${(pzsw.reason3Solve2.choose)!'false'}" name="reason3Solve2" />
	            <div class="clearfix"></div>
	          </div>
          </form>
        </div>
      </div>
    <div class="content-next" >
      			<img width="30px" src="webpages/wx/pzsw/images/arrow.png" alt="">
      </div>    </section>
    <#include "footer.html">
    <script type="text/javascript">
	// 先要对监听的DOM进行一些初始化
	var hammer = new Hammer(document.getElementById("nextContainer"));
	hammer.get('swipe').set({direction:Hammer.DIRECTION_ALL});
	// 然后加入相应的回调函数即可
	hammer.on('swipeup',swipeEvent);
	hammer.on('swipedown',swipeEvent);
	var count = 0;
	function clickA(id) {
// 		alert(id);
		if($('#'+id).hasClass('onclick')) {
			$('#'+id).removeClass('onclick');
			count--;
			$("input[name='"+id+"']").val('false');
		}else {
			$('#'+id).addClass('onclick');
			count++;
			$("input[name='"+id+"']").val('true');
		}
		
	}
	
	function swipeEvent(evt) {
		if(evt.type=='swipedown') {
			window.location.href='pzsw.action?page=content1-3-2';
		} else if(evt.type=='swipeup') {
			var chooseCount = 0;
			$('input').each(function() {  
		         if (this.value == 'true') {  
		        	 chooseCount++;
		         }  
		    });
			if(chooseCount<3) {
				alert('请至少选择3项！');
				return;
			}
			//提交信息
			var formData = $('#selectForm').serialize();
// 			console.log(formData);
			$.ajax({
				type : "POST",
				url : "pzsw.action?submit",
				data : formData, //序列化               
				error : function(request) { // 设置表单提交出错 
					alert('提交错误'); //登录错误提示信息
				},
				success : function(data) {
					var d = $.parseJSON(data);
					if (d.success) {
						window.location.href='pzsw.action?page=content1-5';
					} else {
						alert(d.msg)
					}
					
				}
			});
		}
		
	}
	</script>
  </body>
</html>